import * as mobx from 'mobx';

const { observable, action } = mobx;

export class WFAddShareStore {

    @observable objTypeValue = '57';
    @observable rolelevel = '0';
    @observable jobsLevel = '0';
    @observable objValue = '';
    @observable relatedshareid_6 = '';
    @observable seclevel = '0';
    @observable seclevelMax = '100';
    @observable adviceValue = '1';
    @observable allObjInfo = [];
    @observable jobObjInfo = [];

    @observable replaceDatas = {
        obj : [],
        jobsLevel : []
    };


    constructor () {
        this.objTypeValueChange = this.objTypeValueChange.bind(this);
        this.adviceValueChange = this.adviceValueChange.bind(this);
        this.init = this.init.bind(this);
        this.objValueChange = this.objValueChange.bind(this);
        this.rolelevelChange = this.rolelevelChange.bind(this);
        this.seclevelChange = this.seclevelChange.bind(this);
        this.jobslevelChange = this.jobslevelChange.bind(this);
        this.relatedshareid_6Change = this.relatedshareid_6Change.bind(this);
    }

    @action

    init (objTypeValue = '57') {
        this.objTypeValue = objTypeValue;
        this.objValue = [];
        this.seclevel = 0;
        this.rolelevel = '0';
        this.jobsLevel = '0';
        this.relatedshareid_6 = [];
        this.seclevelMax = 100;
        this.adviceValue = '1';
        this.allObjInfo = [];
        this.jobObjInfo = [];
    }

    objTypeValueChange (value = '57') {
        this.init(value);
    }

    adviceValueChange (value = '1') {
        this.adviceValue = value;
    }

    objValueChange (ids = '',allObjInfo = []) {
        this.objValue = ids;
        this.allObjInfo = allObjInfo;
    }

    rolelevelChange (value = '0') {
        this.rolelevel = value;
    }

    seclevelChange (seclevel,seclevelMax) {

        this.seclevel = seclevel;
        this.seclevelMax = seclevelMax;
    }

    jobslevelChange (jobsLevel = '0') {
        this.jobsLevel = jobsLevel;
    }

    relatedshareid_6Change (ids = '',jobObjInfo = []) {
        this.jobObjInfo = jobObjInfo;
        this.relatedshareid_6 = ids;
    }

    @action
    setReplaceDatas = (value) => {
        this.replaceDatas = {...value};
    }

}